﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MINERP.ComControls.Extension;
using MINERP.MODEL.Statistics;
using MINERP.BLL.Statistics;

namespace MINERP.Statistics.Forms
{
    public partial class FrmOutReturnQuery : Form
    {
        public static FrmOutReturnQuery instance = null;
        private FrmOutReturnQuery()
        {
            InitializeComponent();
            gvOrderInfo.ShowRowIndicator(50);
        }

        public static FrmOutReturnQuery GetInstance
        {
            get
            {
                if (instance == null)
                {
                    instance = new FrmOutReturnQuery();
                }
                return instance;
            }
        }

        private void buttonOK_Click(object sender, EventArgs e)
        {
            Cursor =Cursors.WaitCursor;
            try
            {
                LinkOrderInfo();
            }
            catch(Exception ex)
            {
                MessageBox.Show(ex.Message,"提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
            }
            finally
            {
                Cursor = Cursors.Default;
            }
        }

        private void LinkOrderInfo()
        {
            OutRetunrOrderRecordsBLL _bll = new OutRetunrOrderRecordsBLL();
            gcOrderInfo.DataSource = _bll.GetOutReturnRecords(Convert.ToDateTime(dtStart.Text), Convert.ToDateTime(dtEndTime.Text));
            gcOrderInfo.RefreshDataSource();
        }

        private void FrmOutReturnQuery_Load(object sender, EventArgs e)
        {
            
        }

        private void FrmOutReturnQuery_FormClosing(object sender, FormClosingEventArgs e)
        {
            instance = null;
        }
    }
}
